package com.xbongbong.paas.pojo.dto;

import com.xbongbong.paas.domain.entity.ext.ConditionsEntityExt;
import com.xbongbong.paas.field.FieldAttrEntity;
import com.xbongbong.paas.field.LinkedAttrPoJo;
import com.xbongbong.paas.toolbox.wrap.BaseDTO;
import com.xbongbong.paas.toolbox.wrap.QueryIgnore;
import com.xbongbong.paas.field.LinkInfoPojo;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;

/**
 * @author: wufeng
 * @date: 2018/10/15 8:57
 * @desrcption: 关联数据搜索
 */
@Getter
@Setter
@ToString
public class LinkDataListDTO extends BaseDTO {

    private static final long serialVersionUID = 8893854611050228390L;

    /**
     * 应用id
     */
    @NotNull(message = "{dto.msg.linkDataList.appId.NotNull}")
    private Long appId;
    /**
     * 菜单id
     */
    @NotNull(message = "{dto.msg.linkDataList.menuId.NotNull}")
    @Getter(onMethod_ = {@QueryIgnore})
    private Long menuId;

    /**
     * 表单id
     */
    @NotNull(message = "{dto.msg.linkDataList.formId.NotNull}")
    private Long formId;
    /**
     * 字段标识
     */
    @NotBlank(message = "{dto.msg.linkDataList.attr.NotBlank}")
    private String attr;
    /**
     * 子表单标识
     */
    private String subAttr;

    /**
     * 需要显示的字段
     */
    private List<LinkedAttrPoJo> fieldList;

    /**
     * 搜索条件，只搜索数据信息
     */
    private List<ConditionsEntityExt> conditions;
    /**
     * 分页当前页
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private Integer page;

    /**
     * 分页每页记录数
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private Integer pageSize;

    /**
     *  or：任一； and：全部（筛选项的条件是任一一个满足，还是需要全部满足）
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private String rel;

    private Integer del;

    /**
     *  需要符合的数据
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private Object complianceData;

    /**
     * 需要查询的值
     */
    private List<LinkConditionDataDTO> value;

    /**
     * 关联属性相关字段
     */
    @Valid
    private LinkInfoPojo linkInfo;

    /**
     * @see com.xbongbong.saas.enums.XbbRefTypeEnum
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private Integer businessType;

    /**
     * @see com.xbongbong.pro.enums.SaasMarkEnum
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private Integer saasMark;
    /**
     * 预览字段列表
     */
    @Getter(onMethod_ = {@QueryIgnore})
    private List<FieldAttrEntity> previewFieldList;

    public LinkDataListDTO() {
        rel = "and";
        page = 1;
        pageSize = 20;
        del = 0;
        value = new ArrayList<>();
        fieldList = new ArrayList<>();
    }



}
